import request from '@/utils/request'

// 查询学习计划列表
export function listPlan(query) {
  return request({
    url: '/plan/plan/list',
    method: 'get',
    params: query
  })
}

// 查询简易学习计划列表
export function listSimplePlan(planName) {
  return request({
    url: '/plan/plan/list/simple',
    method: 'get',
    params: planName
  })
}

// 查询学习计划详细
export function getPlan(planId) {
  return request({
    url: '/plan/plan/' + planId,
    method: 'get'
  })
}

// 新增学习计划
export function addPlan(data) {
  return request({
    url: '/plan/plan',
    method: 'post',
    data: data
  })
}

// 修改学习计划
export function updatePlan(data) {
  return request({
    url: '/plan/plan',
    method: 'put',
    data: data
  })
}

// 删除学习计划
export function delPlan(planId) {
  return request({
    url: '/plan/plan/' + planId,
    method: 'delete'
  })
}

// 查询学习计划课程列表
export function bindPlanCourseList(planId) {
  return request({
    url: '/plan/plan/planCourse/list/bind',
    method: 'get',
    params: planId
  })
}

// 查询学习计划未绑定课程列表
export function unBindPlanCourseList(query) {
  return request({
    url: '/plan/plan/planCourse/list/unBind',
    method: 'get',
    params: query
  })
}

// 解绑学习计划课程
export function bindPlanCourseRemove(ids) {
  return request({
    url: '/plan/plan/planCourse',
    method: 'delete',
    params: ids
  })
}

// 绑定学习计划课程
export function unBindPlanCourseAdd(planCourses) {
  return request({
    url: '/plan/plan/planCourse',
    method: 'post',
    data: planCourses
  })
}

// 查询学习计划用户列表
export function bindPlanUserList(planUsers) {
  return request({
    url: '/plan/plan/planUser/list/bind',
    method: 'get',
    params: planUsers
  })
}

// 查询学习计划未绑定用户列表
export function unBindPlanUserList(planUsers) {
  return request({
    url: '/plan/plan/planUser/list/unBind',
    method: 'get',
    params: planUsers
  })
}

// 解绑学习计划用户
export function bindPlanUserRemove(ids) {
  return request({
    url: '/plan/plan/planUser',
    method: 'delete',
    params: ids
  })
}

// 绑定学习计划用户
export function unBindPlanUserAdd(planUsers) {
  return request({
    url: '/plan/plan/planUser',
    method: 'post',
    data: planUsers
  })
}